// @author Tjzlo
// @version 2025/3/7 20:48

package com.old.mapper;

import com.old.entity.History;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface HistoryMapper {

    //查是否存在历史记录-post
    @Select("select * from post_browsing_history where user_id = #{userId} and post_id = #{id}")
    History checkPostHistoryExist(Integer userId, Integer id);
    //添加历史记录-post
    void savePostHistory(History history);
    //修改浏览时间为最新-post
    void updatePostHistory(History history);

    //查是否存在历史记录-video
    @Select("select * from video_browsing_history where user_id = #{userId} and video_id = #{videoId}")
    History checkVideoHistoryExist(Integer userId, Integer videoId);
    //添加历史记录-video
    void saveVideoHistory(History history);
    //修改浏览时间为最新
    void updateVideoHistory(History history);

    //查询所有历史记录-post
    List<History> selectListPost(Object o);
    //查询所有历史记录-video
    List<History> selectListVideo(Object o);
}
